// by Xeno
//#define __DEBUG__
#define THIS_FILE "fn_minefield.sqf"
#include "x_setup.sqf"

private ["_radius", "_center", "_mineTypes", "_mine_type", "_num_mines", "_ran_start_pos", "_m_pos_ar", "_pos", "_mine"];

PARAMS_2(_radius,_center);

_mineTypes = GVAR(LandMines);

_mine_type = _mineTypes call FUNC(RandomArrayVal);

_num_mines = (floor (random 16)) max 10;

_ran_start_pos = [_center, _radius] call FUNC(GetRanPointCircle);
_m_pos_ar = [];

for "_i" from 1 to _num_mines do {
	_m_pos_ar set [count _m_pos_ar, [_ran_start_pos, 100] call FUNC(GetRanPointCircle)];
};

for "_i" from 0 to (_num_mines - 1) do {
	_pos = _m_pos_ar select _i;
	_mine = createMine [_mine_type, _pos, [], 0];
	_mine setDir (random 360);
	GVAR(side_enemy) revealMine _mine;
	GVAR(mines_created) set [count GVAR(mines_created), _mine];
#ifdef __DEBUG__
	[format["mines_%1",_mine], getPosASL _mine,"ICON","ColorOrange",[0.5,0.5],"",0,"n_mortar"] call FUNC(CreateMarkerGlobal);
#endif
};
